package com.cloud.controller;

import com.cloud.Pay;
import com.cloud.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @BelongsProject: my
 * @BelongsPackage: com.cloud.controller
 * @Author: ji ge
 * @CreateTime: 2024-02-02  19:09
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
 public class PaymentController {

    @Value("@{server.port}")
    private String serverPort;

    public static HashMap <Long, Pay> payHashMap =new HashMap<>();
    static {
        payHashMap.put(1L, new Pay (1L, "28a8c1e3bc2742d8848569891fb42181"));
        payHashMap.put(2L, new Pay(2L, "bba8c1e3bc2742d8848569891ac32182"));
        payHashMap.put(3L, new Pay(3L, "6ua8c1e3bc2742d8848569891xt92183"));
    }
    @GetMapping("/paymentSQL/{id}")
    public R<Pay> paymentNacos(@PathVariable("id") Integer id) {
        Pay pay = payHashMap.get(id);
        return new R<Pay>(200,"from mysql port="+serverPort,pay);

    }
}
